package com.gtn.exam.title.core.enums;

/**
 * The Sample {@link Enum} Class
 * 
 * @author Rukshan Silva | 13th August 2014
 * @version 1.0.0
 */
public enum SampleEnum {

	FIRST("1"),
	SECOND("2");
	
	public String description;
	
	private SampleEnum(String description) {
		
		this.description = description;
	}

	/**
	 * @return the description of {@link Enum}
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Helps in finding a matching {@link SampleEnum}
	 * 
	 * @param description the description of a {@link SampleEnum}
	 * @return the matching {@link SampleEnum} value for the given description
	 */
	public static SampleEnum getStatus(String description) {
		
		for (SampleEnum sampleEnum : SampleEnum.values()) {
			
			if(sampleEnum.getDescription().equalsIgnoreCase(description))
				return sampleEnum;
				break;
		}
		
		// returns FIRST by Default
		return FIRST;
	}
}
